package com.fyl.pattern.flyweight;

import java.util.HashMap;

public class Student {
    private String name;
    private int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public static void main(String[] args) {
        HashMap<String, Student> map = new HashMap<>();
        map.put("1",new Student("小明",18));
        Student student = map.get("1");
        Student student1 = map.get("1");
        student1.setAge(19);
        System.out.println(student == student1);
    }
}
